﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using QRCoder;

namespace 花店管理系统.geren
{
    public partial class Zhifu : Form
    {
        public Zhifu()
        {
            InitializeComponent();
        }
        private void GenerateAndShowQrCode(string paymentMethod)
        {
            // 创建二维码生成器
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData qrCodeData = qrGenerator.CreateQrCode(paymentMethod, QRCodeGenerator.ECCLevel.Q);
            QRCode qrCode = new QRCode(qrCodeData);

            Bitmap qrCodeImage = qrCode.GetGraphic(20);

            // 根据PictureBox的大小调整二维码的大小比例
            int imgSize = Math.Min(pictureBox1.Width, pictureBox1.Height);
            Bitmap resizedImage = new Bitmap(qrCodeImage, new Size(imgSize, imgSize));

            // 显示二维码图像
            pictureBox1.Image = resizedImage;
            pictureBox1.Visible = true;

        }

        private void rbWeixin_CheckedChanged(object sender, EventArgs e)
        {
            GenerateAndShowQrCode("支付成功");
        }

        private void rbZhifu_CheckedChanged(object sender, EventArgs e)
        {
            GenerateAndShowQrCode("支付成功");
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            MessageBox.Show("支付成功！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
